{extend name='Public:content'/}
{block name='title'}文章管理{/block}
{block name='content'}
<script type="text/javascript" src="__ADMIN__/js/plugins/summernote/summernote.js"></script>
<div class="row animated fadeIn">
        <div class="col-md-12">
            <div class="panel panel-default tabs">
                <ul class="nav nav-tabs" role="tablist">
                    <li class="active"><a href="#tab-first" role="tab" data-toggle="tab">文章列表
                        <button class="btn btn-success btn-rounded btn-sm">{$postsListNums}</button>
                    </a></li>
                    <li><a href="#tab-second" role="tab" data-toggle="tab">添加文章</a></li>
                </ul>
                <div class="panel-body tab-content">
                    <div class="tab-pane active" id="tab-first">
                        <table class="table table-hover">
                            <thead>
                            <tr>
                                <th>标题</th>
                                <th>摘要</th>
                                <th>作者</th>
                                <th>缩略图</th>
                                <th>所属分类</th>
                                <th>点击量</th>
                                <th>是否审核</th>
                                <th>发布时间</th>
                                <th></th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name='postsList' id='v'}
                            <tr class="del_tr">
                                <td width="220px">{:subtext($v.post_title,50)}</td>
                                <td width="400px">{:subtext($v.post_excerpt,80)}</td>
                                <td>{:get_users($v.post_author)['user_login']}</td>
                                <td style="background: url('{:is_img(getAttr($v.smeta,'thumb'))}');background-size: contain;background-repeat: no-repeat"></td>
                                <td>
                                    {volist name=':get_terms($v["id"])' id='v1'}
                                        <label style="margin-bottom: 50px" class="label label-primary">{$v1.name}</label>
                                    {/volist}
                                </td>

                                <td><span class="badge badge-danger">{$v.post_hits}</span></td>
                                <td>{$v.post_status|is_stop}</td>
                                <td>{$v.post_date|tranTime}</td>
                                <td>
                                    <a title="{:subtext($v.post_title,50)}【编辑】" data-url="{:url('admin/Posts/edit_page_posts',['id'=>$v.id])}" onclick="edit_row(this)"  class="btn btn-default btn-rounded btn-sm"><span class="fa fa-pencil"></span></a>
                                    <button data-url="{:url('admin/Posts/del_think_posts',['id'=>$v.id])}" onClick="delete_row(this);" class="btn btn-danger btn-rounded btn-sm" ><span class="fa fa-trash-o"></span></button>
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                        {$pages}
                    </div>
                    <div class="tab-pane" id="tab-second">
                        <form id="add_form" action="{:url('admin/Posts/add_think_posts')}" method="post" class="form-horizontal">
                            <div class="panel-body">
                                <div class="row">
                                    <div class="col-md-9">
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">上级</label>
                                            <div class="col-md-9">
                                                <select multiple name="smeta[term_relation][]" class="form-control select">
                                                    {volist name='termsList' id='v'}
                                                    <option value="{$v.term_id}">{$v.lefthtml}{$v.name}</option>
                                                    {/volist}
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">文章标题</label>
                                            <div class="col-md-9">
                                                <div class="input-group">
                                                    <span class="input-group-addon"><span class="fa fa-pencil"></span></span>
                                                    <input type="text" name="post_title" class="form-control"/>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">文章摘要</label>
                                            <div class="col-md-9 col-xs-12">
                                                <textarea class="form-control" name="post_excerpt" rows="5"></textarea>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label"></label>
                                            <div class="col-md-9 col-xs-12">
                                                <textarea name="post_content" class="summernote"></textarea>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3  control-label">是否通过</label>
                                            <div class="col-md-9">
                                                <label class="switch">
                                                    <input type="checkbox" name="post_status"  checked value="1"/>
                                                    <span class="help-block"></span>
                                                </label>
                                                <span class="help-block">默认正常</span>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-3">
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">缩略图</label>
                                            <div class="col-md-12">
                                                <div class="gallery" >
                                                    <a class="gallery-item"  href="javascript:void('')" title="Space picture 2" data-gallery>
                                                        <div class="image" >
                                                            <input name="smeta[thumb]" hidden type="text" id="inp">
                                                            <img src="__UPLOAD__/admin/common/upload.svg" alt="Space picture 2"/>
                                                            <ul class="gallery-item-controls">
                                                                <li onclick="upload_single('inp','posts')"><i class="fa fa-cloud-upload"></i></li>
                                                                <li onclick="del_pic('inp')"><i class="fa fa-times"></i></li>
                                                            </ul>
                                                        </div>
                                                    </a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="panel-footer">
                                <button class="btn btn-info pull-right">保存添加<span class="fa fa-floppy-o fa-right"></span></button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
    </div>
</div>
<script type="text/javascript">

</script>
{/block}